﻿@{
    LuanVanEntities db = new LuanVanEntities();
    var listmenu = db.Menus
        .Where(p => p.Level == 2 && p.Parent_id == 4).ToList();
}


<ul class="menudoc">
    @foreach (var mot in ViewBag.Capmot)
    {
        int parentid = mot.Id;
        var childmenu = db.Menus
            .Where(p => p.Level == 3 && p.Parent_id == parentid).ToList();
        <li>
            <a href="/Product/ListByCategory/@mot.Id">
                @if (Request.Cookies["lang"] != null && Request.Cookies["lang"].Value == "vi")
                {
                    @mot.NameVN
                }
                else
                {
                    @mot.Name
                }

            </a>

            <ul>
                @if (childmenu != null && childmenu.Count > 0)
                {
                    foreach (var hai in childmenu)
                    {
                        <li>
                            <a href="/Product/ListByCategory/@hai.Id">

                                @if (Request.Cookies["lang"] != null && Request.Cookies["lang"].Value == "vi")
                                {
                                    @hai.NameVN
                                }
                                else
                                {
                                    @hai.Name
                                }


                            </a>
                        </li>

                    }
                }
            </ul>


        </li>
        

        
           

        
    }


  </ul>
